<template>
  <div class="hb-cpt__scroll-list message-home__list">
    <div
      v-for="(item, index) in followList"
      :key="index"
      class="message__follow-item"
    >
      <div class="follow-item__avatar-wrapper">
        <img :src="item.avatar" alt="" class="follow-item__avatar" />
      </div>
      <div class="follow-item__content">
        <div class="follow-item__username">{{ item.senderName }}</div>
        <div class="follow-item__desc">关注了你</div>
      </div>
      <div class="follow-item__btn"></div>
    </div>
    <div class="scroll-list__no-more-desc">暂无更多内容</div>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { getFollowNotice } from '@/apis/notice'
import { useAccountStore } from '@/stores/useAccountStore'

const accountStore = useAccountStore()
const uid = accountStore.uid

const followList = ref([])

onMounted(async () => {
  try {
    const res = await getFollowNotice(uid)
    if (res?.code === '200' && Array.isArray(res.data)) {
      followList.value = res.data
    }
  } catch (err) {
    console.error('获取关注通知失败', err)
  }
})
</script>

<style scoped>
.hb-cpt__scroll-list {
  padding: 12px 16px;
}
.message__follow-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}
.follow-item__avatar-wrapper {
  margin-right: 12px;
}
.follow-item__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}
.follow-item__content {
  flex: 1;
}
.follow-item__username {
  font-weight: 500;
  font-size: 14px;
  color: #333;
}
.follow-item__desc {
  font-size: 13px;
  color: #888;
  margin-top: 4px;
}
.scroll-list__no-more-desc {
  text-align: center;
  color: #999;
  font-size: 13px;
  padding: 12px 0;
}
</style>
